package aigle.idm.diagraph.tp4.diagram_default_root.part;

import java.util.Collections;
import java.util.List;

import org.eclipse.gef.Tool;
import org.eclipse.gef.palette.PaletteContainer;
import org.eclipse.gef.palette.PaletteGroup;
import org.eclipse.gef.palette.PaletteRoot;
import org.eclipse.gef.palette.PaletteSeparator;
import org.eclipse.gef.palette.ToolEntry;
import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeConnectionTool;
import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCreationTool;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;

/**
 * @generated
 */
public class Tp4PaletteFactory {

	/**
	 * @generated
	 */
	public void fillPalette(PaletteRoot paletteRoot) {
		paletteRoot.add(createDefault1Group());
	}

	/**
	 * Creates "default" palette tool group
	 * @generated
	 */
	private PaletteContainer createDefault1Group() {
		PaletteGroup paletteContainer = new PaletteGroup(
				aigle.idm.diagraph.tp4.diagram_default_root.part.Messages.Default1Group_title);
		paletteContainer.setId("createDefault1Group"); //$NON-NLS-1$
		paletteContainer.add(new PaletteSeparator());
		paletteContainer.add(createCalculateur2CreationTool());
		paletteContainer.add(createPeripherique3CreationTool());
		paletteContainer.add(createLocalisation4CreationTool());
		paletteContainer.add(createVueDocumentation5CreationTool());
		paletteContainer.add(new PaletteSeparator());
		paletteContainer.add(createNomenclature7CreationTool());
		paletteContainer.add(createFamille8CreationTool());
		paletteContainer.add(createDocumentation9CreationTool());
		paletteContainer.add(createProcesseur10CreationTool());
		paletteContainer.add(new PaletteSeparator());
		paletteContainer.add(createInterface12CreationTool());
		paletteContainer.add(new PaletteSeparator());
		paletteContainer.add(createCoordonnee14CreationTool());
		return paletteContainer;
	}

	/**
	 * @generated
	 */
	private ToolEntry createCalculateur2CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				aigle.idm.diagraph.tp4.diagram_default_root.part.Messages.Calculateur2CreationTool_title,
				aigle.idm.diagraph.tp4.diagram_default_root.part.Messages.Calculateur2CreationTool_desc,
				Collections
						.singletonList(aigle.idm.diagraph.tp4.diagram_default_root.providers.Tp4ElementTypes.Calculateur_1001));
		entry.setId("createCalculateur2CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(aigle.idm.diagraph.tp4.diagram_default_root.part.Tp4DiagramEditorPlugin
				.findImageDescriptor("/aigle.idm.diagraph.tp4/icons/Calculateur.gif")); //$NON-NLS-1$
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createPeripherique3CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				aigle.idm.diagraph.tp4.diagram_default_root.part.Messages.Peripherique3CreationTool_title,
				aigle.idm.diagraph.tp4.diagram_default_root.part.Messages.Peripherique3CreationTool_desc,
				Collections
						.singletonList(aigle.idm.diagraph.tp4.diagram_default_root.providers.Tp4ElementTypes.Peripherique_1002));
		entry.setId("createPeripherique3CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(aigle.idm.diagraph.tp4.diagram_default_root.part.Tp4DiagramEditorPlugin
				.findImageDescriptor("/aigle.idm.diagraph.tp4/icons/Peripherique.gif")); //$NON-NLS-1$
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createLocalisation4CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				aigle.idm.diagraph.tp4.diagram_default_root.part.Messages.Localisation4CreationTool_title,
				aigle.idm.diagraph.tp4.diagram_default_root.part.Messages.Localisation4CreationTool_desc,
				Collections
						.singletonList(aigle.idm.diagraph.tp4.diagram_default_root.providers.Tp4ElementTypes.Localisation_1003));
		entry.setId("createLocalisation4CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(aigle.idm.diagraph.tp4.diagram_default_root.part.Tp4DiagramEditorPlugin
				.findImageDescriptor("/aigle.idm.diagraph.tp4/icons/Localisation.gif")); //$NON-NLS-1$
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createVueDocumentation5CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				aigle.idm.diagraph.tp4.diagram_default_root.part.Messages.VueDocumentation5CreationTool_title,
				aigle.idm.diagraph.tp4.diagram_default_root.part.Messages.VueDocumentation5CreationTool_desc,
				Collections
						.singletonList(aigle.idm.diagraph.tp4.diagram_default_root.providers.Tp4ElementTypes.VueDocumentation_1004));
		entry.setId("createVueDocumentation5CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(aigle.idm.diagraph.tp4.diagram_default_root.part.Tp4DiagramEditorPlugin
				.findImageDescriptor("/aigle.idm.diagraph.tp4/icons/VueDocumentation.gif")); //$NON-NLS-1$
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createNomenclature7CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				aigle.idm.diagraph.tp4.diagram_default_root.part.Messages.Nomenclature7CreationTool_title,
				aigle.idm.diagraph.tp4.diagram_default_root.part.Messages.Nomenclature7CreationTool_desc,
				Collections
						.singletonList(aigle.idm.diagraph.tp4.diagram_default_root.providers.Tp4ElementTypes.Nomenclature_2004));
		entry.setId("createNomenclature7CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(aigle.idm.diagraph.tp4.diagram_default_root.part.Tp4DiagramEditorPlugin
				.findImageDescriptor("/aigle.idm.diagraph.tp4/icons/Nomenclature.gif")); //$NON-NLS-1$
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createFamille8CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				aigle.idm.diagraph.tp4.diagram_default_root.part.Messages.Famille8CreationTool_title,
				aigle.idm.diagraph.tp4.diagram_default_root.part.Messages.Famille8CreationTool_desc,
				Collections
						.singletonList(aigle.idm.diagraph.tp4.diagram_default_root.providers.Tp4ElementTypes.Famille_2002));
		entry.setId("createFamille8CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(aigle.idm.diagraph.tp4.diagram_default_root.part.Tp4DiagramEditorPlugin
				.findImageDescriptor("/aigle.idm.diagraph.tp4/icons/Famille.gif")); //$NON-NLS-1$
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createDocumentation9CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				aigle.idm.diagraph.tp4.diagram_default_root.part.Messages.Documentation9CreationTool_title,
				aigle.idm.diagraph.tp4.diagram_default_root.part.Messages.Documentation9CreationTool_desc,
				Collections
						.singletonList(aigle.idm.diagraph.tp4.diagram_default_root.providers.Tp4ElementTypes.Documentation_2003));
		entry.setId("createDocumentation9CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(aigle.idm.diagraph.tp4.diagram_default_root.part.Tp4DiagramEditorPlugin
				.findImageDescriptor("/aigle.idm.diagraph.tp4/icons/Documentation.gif")); //$NON-NLS-1$
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createProcesseur10CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				aigle.idm.diagraph.tp4.diagram_default_root.part.Messages.Processeur10CreationTool_title,
				aigle.idm.diagraph.tp4.diagram_default_root.part.Messages.Processeur10CreationTool_desc,
				Collections
						.singletonList(aigle.idm.diagraph.tp4.diagram_default_root.providers.Tp4ElementTypes.Processeur_2001));
		entry.setId("createProcesseur10CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(aigle.idm.diagraph.tp4.diagram_default_root.part.Tp4DiagramEditorPlugin
				.findImageDescriptor("/aigle.idm.diagraph.tp4/icons/Processeur.gif")); //$NON-NLS-1$
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createInterface12CreationTool() {
		LinkToolEntry entry = new LinkToolEntry(
				aigle.idm.diagraph.tp4.diagram_default_root.part.Messages.Interface12CreationTool_title,
				aigle.idm.diagraph.tp4.diagram_default_root.part.Messages.Interface12CreationTool_desc,
				Collections
						.singletonList(aigle.idm.diagraph.tp4.diagram_default_root.providers.Tp4ElementTypes.Interface_3001));
		entry.setId("createInterface12CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(aigle.idm.diagraph.tp4.diagram_default_root.part.Tp4DiagramEditorPlugin
				.findImageDescriptor("/aigle.idm.diagraph.tp4/icons/Interface.gif")); //$NON-NLS-1$
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createCoordonnee14CreationTool() {
		LinkToolEntry entry = new LinkToolEntry(
				aigle.idm.diagraph.tp4.diagram_default_root.part.Messages.Coordonnee14CreationTool_title,
				aigle.idm.diagraph.tp4.diagram_default_root.part.Messages.Coordonnee14CreationTool_desc,
				Collections
						.singletonList(aigle.idm.diagraph.tp4.diagram_default_root.providers.Tp4ElementTypes.CalculateurCoordonnee_3002));
		entry.setId("createCoordonnee14CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(aigle.idm.diagraph.tp4.diagram_default_root.part.Tp4DiagramEditorPlugin
				.findImageDescriptor("/aigle.idm.diagraph.tp4/icons/coordonnee.gif")); //$NON-NLS-1$
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private static class NodeToolEntry extends ToolEntry {

		/**
		 * @generated
		 */
		private final List<IElementType> elementTypes;

		/**
		 * @generated
		 */
		private NodeToolEntry(String title, String description,
				List<IElementType> elementTypes) {
			super(title, description, null, null);
			this.elementTypes = elementTypes;
		}

		/**
		 * @generated
		 */
		public Tool createTool() {
			Tool tool = new UnspecifiedTypeCreationTool(elementTypes);
			tool.setProperties(getToolProperties());
			return tool;
		}
	}

	/**
	 * @generated
	 */
	private static class LinkToolEntry extends ToolEntry {

		/**
		 * @generated
		 */
		private final List<IElementType> relationshipTypes;

		/**
		 * @generated
		 */
		private LinkToolEntry(String title, String description,
				List<IElementType> relationshipTypes) {
			super(title, description, null, null);
			this.relationshipTypes = relationshipTypes;
		}

		/**
		 * @generated
		 */
		public Tool createTool() {
			Tool tool = new UnspecifiedTypeConnectionTool(relationshipTypes);
			tool.setProperties(getToolProperties());
			return tool;
		}
	}
}
